/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Graphisme;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Label;
import java.util.Calendar;
import java.util.List;
import java.util.Vector;
import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import moyensDeTransport.Avion;

/**
 *
 * @author BENAMMAR Riyadh
 */
public class Resultats extends JFrame{
    
    //private Vector<JComboBox> filtres;
    
    private Resultat [] propositions;
    private JTable choix;
    
    public Resultats(Resultat [] resultats){
        super();
        setMinimumSize(new Dimension(400, 100));
        propositions=resultats;
        int nbrResultats;
        if(resultats!=null)nbrResultats=propositions.length;
        else nbrResultats=2;
        setLayout(new GridLayout(nbrResultats+1, 4));
        
        for (int i = -1; i < nbrResultats; i++) {
            JLabel numero=new JLabel(String.valueOf(i+1));
            //numero.setFont(new Font("Tahoma",Font.BOLD,16));
            if(i==-1){
                JLabel n=new JLabel("Numéro");
                n.setFont(new Font("Tahoma",Font.BOLD,16));
                n.setBorder(BorderFactory.createLineBorder(Color.BLACK));
                n.setHorizontalAlignment(JLabel.CENTER);
                getContentPane().add(n);
                JLabel n2=new JLabel();
                n2.setFont(new Font("Tahoma",Font.BOLD,16));
                n2.setBorder(BorderFactory.createLineBorder(Color.BLACK));
                n2.setText("Départ");
                n2.setHorizontalAlignment(JLabel.CENTER);
                getContentPane().add(n2);
                JLabel n3=new JLabel();
                n3.setText("En cours de visite");
                n3.setFont(new Font("Tahoma",Font.BOLD,16));
                n3.setBorder(BorderFactory.createLineBorder(Color.BLACK));
                n3.setHorizontalAlignment(JLabel.CENTER);
                getContentPane().add(n3);
                JLabel n4=new JLabel();
                n4.setText("retour");
                n4.setFont(new Font("Tahoma",Font.BOLD,16));
                n4.setBorder(BorderFactory.createLineBorder(Color.BLACK));
                n4.setHorizontalAlignment(JLabel.CENTER);
                getContentPane().add(n4);
                continue;
            }
            numero.setBorder(BorderFactory.createLineBorder(Color.BLACK));
            numero.setHorizontalAlignment(JLabel.CENTER);
            getContentPane().add(numero);
            //recuperation des JPanel associés à chaque résultat
            //getContentPane().add(new JLabel("tt"));
            /*Avion v=new Avion();
            v.setAdresseArrivee("tlemcen");
            v.setAdresseDepart("lyon");
            v.setDateDebut(Calendar.getInstance().getTime());
            v.setDateFin(Calendar.getInstance().getTime());
            getContentPane().add(v.getPanel());*/
            List<Object> donnesD=resultats[i].getDonneesDepart();
            JPanel panelAssocie=resultats[i].getAssociatedPanel(donnesD);
            JScrollPane jsp1=new JScrollPane((panelAssocie));
            //getContentPane().add(new JLabel("Séjour"));
            JScrollPane jsp2=new JScrollPane((resultats[i].getAssociatedPanel(resultats[i].getDonneesSejour())));
            //JScrollPane jsp2=new JScrollPane((resultats[i].getAssociatedPanel(resultats[i].getDonneesSejour())));
            JScrollPane jsp3=new JScrollPane((resultats[i].getAssociatedPanel(resultats[i].getDonneesRetour())));
            getContentPane().add(jsp1);
            getContentPane().add(jsp2);
            getContentPane().add(jsp3);
            pack();
            
            
        }
    }
  
    public static void main(String[] args) {
        Resultats r=new Resultats(null);
        r.setVisible(true);
        
    }
    
}
